algo 8128

Read about algo 8128, The latest news, videos, and discussion topics about algo 8128 from alibabacloud.com

Algo-139_ Blue Bridge Cup _ algorithm training _s01 string (recursive)

The problem description S01 string is initially " 0 " Transform 0 Change to 01 input format 1 integers (0~ +) output format N-transform S01 String Sample input 3 Sample Output 101 data size and conventions 0~Remember:The information given by the topic is misleading, so people can't see the law (1 should be "1")The specific requirements are obtained by looking at the results of the test data (Lll¬ω¬)That is: the string of n = (n-1 string) + (N-2 string)AC Code:1#include 2 #defineMAX 100103 4 /*de

Algo-39_ Blue Bridge Cup _ Algorithm Training _ array sorting de-weight

The problem description enters a sequence of 10 integers that requires ascending sorting and removes duplicate elements. Enter a format of 10 integers. Output format multiple lines of output, one element per line. Sample input 2233115555 Sample Output 1235Problem Solving Ideas:If the input number exists in the array, it is excluded, otherwise the storageSort from small to large, and outputAC Code:1#include 2 #defineMAX 103 4 intMainvoid)5 {6 inti =0, j =0, k =0;7 intarr[max+1];8 fo

ALGO-79 Deleting an array of 0 elements

Algorithm training Delete Array 0 element time limit: 1.0s memory limit: 512.0MB Reads n integers from the keyboard into the array, writes the function compactintegers, deletes all elements with a value of 0 in the array, and then moves the elements to the first end of the array. Note that the Compactintegers function needs to accept the array and its number of elements as arguments, and the function return value should be the number of new elements of the array after the delete operation execut

Blue Bridge Cup algorithm training ALGO-124 digital triangles

); + A System.out.println (maxsum); at } - /** - * Maximum and - * @paramRow number of rows - * @paramarr Array - * @returnthe path of the maximum and in */ - Private Static intMaxsum (intRowint[] arr) { to for(inti = row-2; I >= 0; i--){ + for(intj = 0; J ){ -ARR[I][J] + = Maxnum (arr[i+1][j), arr[i+1][j+1]); the } * } $ returnArr[0][0];Panax Notoginseng } - the /** + * Find the maximum numbe

Blue Bridge Cup algorithm training ALGO-125 wang, HOU legend

+ intm = y-2 > 0? y-2:0;//the starting position of the Emperor's column range ax = x > n-1? N-1: x;//the end position of the Emperor's line range aty = y > n-1? N-1: y;//the end position of the Emperor column range - -Column_num =New int[n]; -Palace =New int[n][n]; - - for(inti = k; I //Emperor Range-1 in for(intj = m; J ){ -palace[i][j] = 1; to } + } - thePlace (0); * $System.out.println (count);//number of o

Blue Bridge-cup Algorithm training ALGO-156 expression calculation

((src.charat (k) = = ' + ' | | | Src.charat (k) = = '-') (temp.length ()! = 0)) the break; the the temp.append (src.charat (k));94 Src.deletecharat (k); the } the they =integer.parseint (temp.tostring ());98Temp.delete (0, Temp.length ()); about - Switch(OP) {101 case+:102sum = x +y;103Src.deletecharat (k-1);//Delete operator104Src.insert (k-1, sum + "");//the result is stored in the operator position of SRC (the numbe

Blue Bridge Cup algorithm training ALGO-151 6-2 recursive binary representation of digits

representation of the number of bits. added: Decimal to 16 binary: integer.tohexstring (int i)decimal Turn octal: integer.tooctalstring (int i)decimal Turn binary: integer.tobinarystring (int i)hexadecimal to decimal: integer.valueof ("FFFF", +). ToString ()Octal decimal: integer.valueof ("123", 8). ToString ()Binary to decimal: integer.valueof ("1001", 2). ToString ()Example code:1 ImportJava.util.Scanner;2 3 Public classMain {4 Public Static voidMain (string[] args) {5Scanner sc =NewSca

Blue Bridge Cup algorithm training ALGO-147 4-3 daffodils number

Algorithm training 4-3 Daffodils number time limit: 1.0s memory Limit: 256.0MB problem description Print all daffodils between 100 and 999. The so-called Narcissus number refers to the number of cubes that satisfy them and the integers for the number itself, such as 153=1^3+5^3+3^3. Sample input An input example that satisfies the requirements of the topic.Cases:No sample output 153XxxXxxTopic Analysis:This is a simple problem of brute force cracking. Simply break down the hundred, 10, and digit

Blue Bridge Cup algorithm training ALGO-150 6-1 recursive two-item coefficient value

Algorithm training 6-1 Recursive two-term coefficient value time limit: 10.0s memory Limit: 256.0MB problem Description Sample Enter an input example that satisfies the requirements of the topic.3 10 Sample output corresponds to the output of the sample input above.Data size and convention the range of each number in the input data.Example: The result does not overflow when int is represented.Topic Analysis:for recursive problems, we pay attention to two points: (1) Find the exit; (2) Find simil

Blue Bridge Cup algorithm training ALGO-126 daffodils

Algorithm training Narcissus time limit: 1.0s memory limit: 256.0MB Narcissus number problem description judge giventhree-digit numberWhether Narcissus number. The so-called Narcissus number refers to its value equal to its own number of cubic meters per digit. Example 153 is a number of daffodils. 153=13+53+33 an integer in the input format. Output format is narcissus number, output "YES", otherwise output "no" (not including quotation marks) sample input 123 sample output no data size and conv

Interval k large number find Java Blue Bridge Cup ALGO-1

use the sort () function, directly using the Arrays.sort () function array of small to large order, each time the results are directly output.At the same time, I need to clear the results after the loop, I use the Arrays.fill () function, with ' "" to fill, but there are insufficient places, will be emptied after the form of 0 exist, the length of the array has not changed, so need me to further improve, the final evaluation results still have a run timeout!! , for informational purposes onlyIn

Algo-143_ Blue Bridge Cup _ Algorithm Training _ String transformation

; * /*output the entire string in reverse order*/ $ Case 3:Panax Notoginseng for(i = strlen (arr)-1; I >=0; I--) - { theprintf"%c", Arr[i]); + } A Break; the /*converts the corresponding uppercase letter in a string to lowercase letters, lowercase to uppercase*/ + Case 4: - for(i =0; I ) $ { $ if(Arr[i] >='A' Arr[i] 'Z') - { -Arr[i] + = +; the

Blue Bridge Cup ALGO-111 random number (sort, go weight)

"Idea": vector perfect solution. Notice the dynamic array of vectors, or else 0."AC Code":#include Blue Bridge Cup ALGO-111 random number (sort, go weight)

Algo-145_ Blue Bridge Cup _ algorithm training _4-1 print the following graphic

Remember:The wording of printf ("%*s%s%*s\n", N-i, "", Arr,n-i, "") is used here,where the * in%*s represents the number of the string s, S is given to the string,This is usually used for printing.AC Code:1#include 2 #defineMAX 503 4 intMainvoid)5 {6 intI,n;7 Chararr[max+1];8scanf"%d",n);9sprintf (arr,"%s","*");Ten for(i =1; I ) One { Aprintf"%*s%s%*s\n", N-i,"", Arr,n-i,""); -sprintf (arr,"%s%s", arr,"**"); - } the - return 0; -}

Blue Bridge Cup algorithm training ALGO-139 S01 String

Algorithm Training S01 StringTime limit: 1.0s memory limit: 256.0MBProblem descriptionS01 string is initially "0"Transform as follows0 Change to 01Input format1 integers (0~19)Output formatS01 string after n-Times transformationSample input3Sample output101Data size and conventions0~19Example code:1 ImportJava.util.Scanner;2 3 Public classMain {4 StaticStringBuffer SB =NewStringBuffer ();5 Public Static voidMain (string[] args) {6Scanner sc =NewScanner (system.in);7 intn =sc.ne

Blue Bridge Cup algo--6 Comfort Cow (minimum spanning tree)

much or not clear, and then on the Internet to learn from the great God code, just understand how.1#include 2#include 3#include 4 using namespacestd;5 structnode{6 ints,e,v;7}edge[100010];8 intm=0, n,val[10010],p;9 voidAddintSintEintv) {Tenedge[++m].s=s; OneEdge[m].e=e; Aedge[m].v=v; - } - intfather[10010]; the intFINDF (inti) {//and check set, intends to use Kruskal to calculate the minimum spanning tree; - if(father[i]==i)returni; - Else returnfather[i]=findf (Father[i]); - } + BO

Blue Bridge Cup algorithm training ALGO-117 friendly number

Algorithm training friendly number time limit: 1.0s memory limit: 256.0MB The problem description has two integers, and if the approximate sum of each integer is equal to the other (except for itself), we call this logarithm friendly. For example:9 Approximate and have: 1+3=44 Approximate and have: 1+2=3So 9 and 4 are not friendly.220 approximate and With: 1 2 4 5 10 11 20 22 44 55 110=284284 Approximate and With: 1 2 4 71 142=220So 220 and 284 are friendly.Write a program to determine whether t

Hackerrank-[Algo] Matrix Rotation

(1, CC, 1): - # Down ins[(rr-1 + i) * m + (j + i)] = (rr-1 + i) * m + (j-1 +i) - forJinchXrange (Rr-2,-1,-1): to # Right +s[(j + i) * m + (cc-1 + i)] = (j + 1 + i) * m + (cc-1 +i) - forJinchXrange (Cc-2,-1,-1): the #Top *S[i * m + (j + i)] = i * m + (j + 1 +)i) $i + = 1Panax Notoginseng returns - the defMultiply (A, b): +n =Len (a) Ac = [] the forIinchxrange (n): + c.append (A[b[i]) - returnC $ $ defDisplacepow (A, k): -

Blue Bridge Cup ALGO-93 inverse number (math, function)

"Ideas": Use of Atoi and itoa, note atoi, three parameters. The first one is the number to convert, the second is the one that is stored in that string, and the third is what the binary is. "AC Code":#include Blue Bridge Cup ALGO-93 inverse number (math, function)

Blue Bridge Cup ALGO-94 freshman Prom (structural)

"Thinking": The rhythm of the brush water problem."AC Code": #include Blue Bridge Cup ALGO-94 freshman Prom (structural)

Total Pages: 15 1 2 3 4 5 .... 15 Go to: Go

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.